package com.tmeone.erpone.service.impl;

import com.tmeone.erpone.entity.SUserRole;
import com.tmeone.erpone.mapper.SUserRoleMapper;
import com.tmeone.erpone.service.ISUserRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author tmeone
 * @since 2021-04-16
 */
@Service
public class SUserRoleServiceImpl extends ServiceImpl<SUserRoleMapper, SUserRole> implements ISUserRoleService {
    @Autowired
    private SUserRoleMapper sUserRoleMapper;

    @Override
    public void insertUserRole(String userId, String roleIdL, String roleId) {
        if (roleIdL.equals("0")){
            sUserRoleMapper.intsertUserRole(userId,roleId);
        }else {
            sUserRoleMapper.deleteUserRole(userId);
            sUserRoleMapper.intsertUserRole(userId,roleId);
        }
    }
}
